﻿using System.Collections.Generic;
using System.Data;

/// <summary>
/// SwaggerDataTable
/// </summary>
public class SwaggerDataTable
{
    public List<Dictionary<string, object>> Rows { get; set; }

    public SwaggerDataTable(DataTable dataTable)
    {
        Rows = new List<Dictionary<string, object>>();
        foreach (DataRow row in dataTable.Rows)
        {
            Dictionary<string, object> dict = new Dictionary<string, object>();
            foreach (DataColumn column in dataTable.Columns)
            {
                dict[column.ColumnName] = row[column]?.ToString();
            }
            Rows.Add(dict);
        }
    }

}